import React, { Component } from 'react'
import { connect } from 'react-redux';
import { getListAction, getMoiveListAction } from '../store/actions';
//import VideoList from '../components/VideoList';
import MovieList from '../components/MovieList';
import MyFooter from '../components/MyFooter';


const List = class List extends Component {
  componentWillMount() {
    // this.props.getList();
    this.props.getMovieList();
  }
  render() {
    return (
      <div className="page">
        <div className="page-content">


          {/*** <VideoList {...this.props}></VideoList> */}
          <MovieList {...this.props}></MovieList>

        </div>

        <MyFooter></MyFooter>
      </div>
    )
  }
}

const mapStateToProps = (state) => {
  return {
    ...state
  };
}


const mapDispatchToProps = (dispatch) => {
  return {
    // 异步方法

    // 获取视频播放列表
    getList() {
      dispatch(getListAction())
    },

    // 获取电影票列表
    getMovieList() {
      dispatch(getMoiveListAction());
    },

    // 设置当前选中tab下的视频播放列表
    setCurrentList(index) {
      dispatch({ type: 'SET_CURRENT_LIST', data: index })
    },

    // 设置当前选中下的电影列表
    selectMoives(cinema, date) {
      dispatch({ type: 'SELECT_MOVIES', data: { currentCinema: cinema, currentDate: date } })
    }



  }
}

export default connect(mapStateToProps, mapDispatchToProps)(List);